/**
 * 文件删除 & 重命名 & 移动文件(剪切) https://www.bilibili.com/video/BV1vs411n7TH?p=125
 */
#include <windows.h>
#include "../Utils/FileIOUtils.h"

static char *FILE_READ_PATH = "../Read_Write_Test/test.txt";
static char *FILE_COPY_PATH = "../Read_Write_Test/10.文件重命名前.txt";
static char *FILE_RENAME_PATH = "../10.文件重命名后啊.txt";


int main() {
    //1.copy
    int fail0 = file_copy(FILE_READ_PATH, FILE_COPY_PATH, 1);
    if (fail0) {
        printf("文件复制失败, fail0 = %d\n", fail0);
    } else {
        printf("文件复制成功!\n");
    }

    //2.重命名 & 移动文件(剪切),  移动到上一个目录↘
    int fail1 = file_rename_and_move(FILE_COPY_PATH, FILE_RENAME_PATH);
    if (fail1) {
        printf("文件重命名失败, fail1 = %d\n", fail1);
    } else {
        printf("文件重命名成功!\n");
    }
    
    //3.删除
    printf("文件2秒后将被删除!\n");
    Sleep(2000UL);
    int fail2 = file_remove(FILE_RENAME_PATH);
    if (fail2) {
        printf("文件删除失败, fail2 = %d\n", fail2);
    } else {
        printf("文件删除成功!\n");
    }

    return EXIT_SUCCESS;
}